/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef AUDIO_STREAM_CHECKER_THREAD
#define AUDIO_STREAM_CHECKER_THREAD

#include <mutex>
#include <vector>
#include <atomic>
#include "audio_utils.h"
#include "audio_task_loop.h"
#include "audio_stream_checker.h"

namespace OHOS {
namespace AudioStandard {
class AudioStreamCheckerThread : public std::enable_shared_from_this<AudioStreamCheckerThread> {
public:
    static std::shared_ptr<AudioStreamCheckerThread> GetInstance();
    void AddThreadTask(std::shared_ptr<AudioStreamChecker> checker);
    void DeleteThreadTask(std::shared_ptr<AudioStreamChecker> checker);
    std::vector<std::shared_ptr<AudioStreamChecker>> checkerVec_;

private:
    std::mutex checkerVecMutex_;
    std::atomic<uint32_t> currentTaskCount_ = 0;
    std::shared_ptr<AudioLoopThread> taskLoop_ = nullptr;
};
}
}
#endif